import 'package:flutter/material.dart';

class MyApp3 extends StatefulWidget {
  const  MyApp3({super.key});



  @override
  State<MyApp3> createState() => _MyApp3State();
}

class _MyApp3State extends State<MyApp3> {
  String name = "老王";
int age = 18;
  @override
  Widget build(BuildContext context) {
    return  Scaffold(
      // 1.1 导航
      appBar: AppBar(
        backgroundColor: Colors.pink,
        title: const Text('Hello Flutter'),
      ),
      // 1.2 主体部分
      body:  Center(
        child: Text(
          // 'Hello, Flutter',
          '$name,$age',
          textDirection: TextDirection.ltr,
          style: TextStyle(
              fontSize: 30.0, color: Colors.red, fontWeight: FontWeight.bold),
        ),
         
      ),
      floatingActionButton: FloatingActionButton(
        onPressed: () {
          setState(() {
           age = age+1;
          });
        },
        child: const Icon(Icons.add),
      
),
    );
  }
}